package com.web;

import org.apache.catalina.startup.Tomcat;
import org.springframework.stereotype.Component;

@Component
public class MyTomcat implements WebServerFactory{
    @Override
    public void createServer() throws Exception {
        //启动Tomcat
        Tomcat tomcat = new Tomcat();
        tomcat.setPort(8081);

        tomcat.addWebapp("/","E://temp");//完成监听
        tomcat.start();
        tomcat.getServer().await();//阻塞，接收处理请求

    }
}
